import request from '@/utils/dianRequest'

// 用户注册
export function userZhuCe(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}

// 用户登录
export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 退出方法
export function goOrder(data) {
  return request({
    url: '/api/toAlipayRecharge',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: '/user/getUserInfo',
    method: 'get'
  })
}

// 获取首页商品列表
export function getGoodsList(data) {
  return request({
    url: '/commodity/list',
    method: 'post',
    data
  })
}

// 获取商品信息
export function getGoodsDetail(data) {
  return request({
    url: '/commodity/info',
    method: 'post',
    data
  })
}

// 添加购物车
export function addShoppingCart(data) {
  return request({
    url: '/commodity/shoppingCart',
    method: 'post',
    data
  })
}

// 获取购物车列表
export function getShoppingCartList() {
  return request({
    url: '/commodity/shoppingCartList',
    method: 'get'
  })
}

// 获取包装盒列表
export function getBoxList() {
  return request({
    url: '/box/list',
    method: 'get'
  })
}
// 新增包装盒
export function addBox(data) {
  return request({
    url: '/box/save',
    method: 'post',
    data
  })
}

// 删除购物车某个商品
export function removeShoppingCart(data) {
  return request({
    url: '/commodity/removeShoppingCart',
    method: 'post',
    data
  })
}

// 清空购物车
export function clearShoppingCart(data) {
  return request({
    url: '/commodity/clearShoppingCart',
    method: 'get'
  })
}


// 生成订单
export function orderSave(data) {
  return request({
    url: '/order/save',
    method: 'post',
    data
  })
}

// 确认订单
export function addToPay(data) {
  return request({
    url: '/api/toAlipayRecharge',
    method: 'post',
    data
  })
}

// 获取订单列表
export function orderList(data) {
  return request({
    url: '/order/buyersList',
    method: 'post',
    data
  })
}

// 取消订单
export function orderCancel(data) {
  return request({
    url: '/order/cancel',
    method: 'post',
    data
  })
}

// 支付阿里
export function toAlipayRecharge(data) {
  return request({
    url: '/api/toAlipayRecharge',
    method: 'post',
    data
  })
}

// 商品评价
export function pingJiaApi(data) {
  return request({
    url: '/comment/save',
    method: 'post',
    data
  })
}

// 更新用户信息
export function bind(data) {
  return request({
    url: '/user/bind',
    method: 'post',
    data
  })
}

// 重置用户密码
export function updatePassWord(query) {
  return request({
    url: '/user/updatePwd',
    method: 'post',
    params: query
  })
}